package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * Created with IntelliJ IDEA.
 * User: DK
 * Date: 9/25/13
 * Time: 10:27 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserList {

    private static ArrayList<User> users;
    private static User selectedUser;

    public UserList()
    {
        users = User.produceDefaultUsers();
    }

    public static boolean contains(String username, String password) {

        User currentUser = new User(username,password);

        Iterator iteratorOverUsers = users.iterator();

        while(iteratorOverUsers.hasNext())
        {
            User user = (User)iteratorOverUsers.next();
            if (user.match(currentUser))
            {
                return true;
            }
        }

        return false;
    }

    public static User returnSelectedUser(String username, String password)
    {
        User currentUser = new User(username,password);

        Iterator iteratorOverBooks = users.iterator();

        while(iteratorOverBooks.hasNext())
        {
            User user = (User)iteratorOverBooks.next();
            if (user.match(currentUser))
            {
                return user;
            }
        }

        return new User();
    }

    public static String getNameOf(String username) {
        return null;  //To change body of created methods use File | Settings | File Templates.
    }

    public static String getEmailAddressOf(String username) {
        return null;  //To change body of created methods use File | Settings | File Templates.
    }

    public static String getPhoneNumberOf(String username) {
        return null;  //To change body of created methods use File | Settings | File Templates.
    }
}
